package freebird;

import java.awt.Frame;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.BorderLayout;
import java.awt.event.*;
import javax.swing.*;
public class MainFrame extends JFrame
{
    private JTextField pingJiaTitle;
    private JTextField pingJiaName;
    private JTextField pianJiaTitle;
    private JTextField pianJiaName;
    private JTextField luoMaTitle;
    private JTextField luoMaName;
    private JPanel panel;

    private JButton startButton;
    private JButton pauseButton;
    private JButton stopButton;
    private JButton continueButton;
    private JPanel buttonPanel;

    public MainFrame()
    {
	super("努力学习日语，每天都要进步一点");
	setSize(1024,768);
	Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
	setLocation((screenSize.width-1024)/2,(screenSize.height-768)/2);
	addWindowListener(new WindowAdapter()
	    {
		public void windowClosing(WindowEvent e)
		{
		    System.exit(0);
		}
	    }
	    );

	initComponents();
    }

    private void initComponents()
    {
	setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
	//add some text fields for showing data
	panel=new JPanel();

	pingJiaTitle=new JTextField("平假名",10);
	pingJiaTitle.setEditable(false);
	
	pingJiaName=new JTextField("平假名.",20);
	pingJiaName.setEditable(false);
	
	pianJiaTitle=new JTextField("片假名",10);
	pianJiaTitle.setEditable(false);
	
	pianJiaName=new JTextField("片假名.",20);
	pianJiaName.setEditable(false);

	luoMaTitle=new JTextField("罗马字",10);
	luoMaTitle.setEditable(false);
	
	luoMaName=new JTextField("罗马字.",20);
	luoMaName.setEditable(false);
	
	panel.add(pingJiaTitle);
	panel.add(pingJiaName);

	panel.add(pianJiaTitle);
	panel.add(pianJiaName);

	panel.add(luoMaTitle);
	panel.add(luoMaName);

	add(panel,BorderLayout.NORTH);

	//add some control button
	startButton=new JButton("启动");
	stopButton=new JButton("停止");
	pauseButton=new JButton("暂停");
	continueButton=new JButton("继续");
	
	buttonPanel=new JPanel();
	
	buttonPanel.add(startButton);
	buttonPanel.add(stopButton);
	buttonPanel.add(pauseButton);
	buttonPanel.add(continueButton);

	startButton.setDefaultCapable(true);
	stopButton.setEnabled(false);
	pauseButton.setEnabled(false);
	continueButton.setEnabled(false);
	add(buttonPanel,BorderLayout.SOUTH);


	startButton.addActionListener(new ActionListener() 
	    {
            public void actionPerformed(ActionEvent evt) {
                startButtonActionPerformed(evt);
            }
	    }
	    );
    }

    private  void startButtonActionPerformed(ActionEvent evt)
    {
	
    }
}

